package cn.wnco.ctrl;

import cn.wnco.tool.JwtTool;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static cn.wnco.conf.Const.*;

@RestController
@RequestMapping("user")
public class UserCtrl {
    @GetMapping("login")
    public String login() {
        Map<String, Object> map = new HashMap<>();
        List<String> auths = List.of(new String[]{"auth1", "auth2"});
        List<String> roles = List.of(new String[]{"role1", "role2"});
        map.put(key_uid, 123);
        map.put(map_role, roles);
        map.put(map_auth, auths);
        return JwtTool.createToken(map);
    }
}
